package packetizer

// RTPPayLoader payloads file packets
type RTPPayLoader struct{}

func (p *RTPPayLoader) Payload(mtu uint16, payload []byte) [][]byte {
	var out [][]byte
	if payload == nil || mtu <= 0 {
		return out
	}

	for len(payload) > int(mtu) {
		o := make([]byte, mtu)
		copy(o, payload[:mtu])
		payload = payload[mtu:]
		out = append(out, o)
	}

	if len(payload) > 0 {
		o := make([]byte, len(payload))
		copy(o, payload)
		return append(out, o)
	} else {
		return out
	}
}
